#include <iostream>
using namespace std;
int main()
{
	int n,i,l[10000],l2[100],t=0,g=0,sign=0;
	cin>>n;
	for (i=0;i<n;i++)
	{
		cin>>l[i];
	}
	for (i=0;i<n;i++)
	{
		if (l[i]+1==l[i+1])
		{
			t = t + 1;
			sign = 1;
		}
		else if (sign==1 && l[i]+1!=l[i+1])
		{
			g = g + 1;
			l2[g] = t;
			t = 0;
			sign = 0;
			continue;
		}
		else continue;
	}
	t = l2[1];
	for (i=1;i<=g;i++)
	{
		if (l2[i]>t) t = l2[i];
		else continue;
	}
	t = t + 1;
	cout<<t<<endl;
	return 0;
}
